package test.yzx.pproject.act3;

import android.app.AlertDialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import test.yzx.pproject.R;

public class ViewPositionOnScreenActivity extends AppCompatActivity{

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_position_on_screen);

        final View view = findViewById(R.id.view);
        view.post(new Runnable() {public void run() {
            int[] xy = new int[2];
            view.getLocationOnScreen(xy);

            AlertDialog dialog = new AlertDialog.Builder(ViewPositionOnScreenActivity.this).setMessage("xxxxxx").create();
            dialog.show();


        }});


    }

}
